#include "server.hpp"

int main()
{
    // 测试3:
    Buffer buf;
    for (int i = 0; i < 300; ++i)
    {
        std::string str = "hello!!" + std::to_string(i) + '\n';
        buf.WriteStringAndPush(str);
    }
    while (buf.ReadAbleSize() > 0)
    {
        std::string line = buf.GetLineAndPop();
        // std::cout << line;
        DLOG("hello");
    }
    /*
    测试1:
        Buffer buf;
        std::string str = "hello!!";
        buf.WriteStringAndPush(str);

        std::string tmp;
        tmp = buf.ReadAsStringAndPop(buf.ReadAbleSize());
        std::cout << tmp << std::endl;
        std::cout << buf.ReadAbleSize() << std::endl;

        测试2:
        Buffer buf;
        std::string str = "hello!!";
        buf.WriteStringAndPush(str);

        Buffer buf1;
        buf1.WriteBufferAndPush(buf);

        std::string tmp;
        tmp = buf1.ReadAsStringAndPop(buf1.ReadAbleSize());

        std::cout << tmp << std::endl;
        std::cout << buf.ReadAbleSize() << std::endl;
        std::cout << buf1.ReadAbleSize() << std::endl;
    */
    return 0;
}
